<template>
    <el-input-number :disabled="disabled" v-bind="$attrs" v-model="val" />
</template>

<script setup>
import { watch, ref } from "vue";

const props = defineProps({
  modelValue: Number,
  multiple:{
    type:Number,
    default:10.0,
  },
  disabled: {
    type: Boolean,
    default: false,
  },
});

const emit = defineEmits(["update:modelValue"]);

const val = ref((props.modelValue || 0) / props.multiple);

watch(()=>props.modelValue, (newVal,oldVal)=>{
  val.value = (newVal || 0) / props.multiple;
})

watch(val, (newVal, oldVal) => {
  emit("update:modelValue",  parseInt(newVal * props.multiple));
});

</script>
